package com.example.crm.dao.impl;

import com.example.crm.dao.IUserDAO;
import com.example.tools.DBUtils;

import java.sql.*;

public class UserDAOlmpl implements IUserDAO {
    @Override
    public boolean findByUsernamePassword(String username, String password) throws SQLException {
        //连接数据库
        Connection conn = DBUtils.getConnection();
        //得到查询对象
        Statement stmt=conn.createStatement();
        //执行sql语句
        String sql="select * from user where username = '"+username+"' and password='"+password+"';";
        System.out.println();
        ResultSet rs=stmt.executeQuery(sql);
        //得到结果集
        if(rs.next()){
            return true;
        }else
        {
            return false;
        }
        //返回结果

    }
}
